//src\renderer\store\useBaseStore.ts
import { defineStore } from "pinia";
import { type Ref, ref } from "vue";

// 定义 store 数据类型
interface BaseStoreData {
  name: string;
  qwenPlusApiKey: string;
}

//定义一个Store
export const useBaseStore = defineStore("base", () => {
  let data: Ref<BaseStoreData> = ref({
    name: "aksu",
    qwenPlusApiKey: localStorage.getItem('qwenPlusApiKey') ?? "sk-4cd59a1b320540a0869131d1f20d284b",
  });
  let changeName = (item: string) => {
    if (item) return;
    data.value.name = item ?? data.value.name + "1";
  };
  return { data, changeName };
});